<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>XXX后台管理系统</title>
    <script src="js/jquery-3.2.1.js"></script>
    <script src="layui/layui.js"></script>
    <script src="layui/lay/modules/layer.js"></script>
    <link rel="stylesheet" type="text/css" href="layui/css/layui.css">
    <link rel="stylesheet" type="text/css" href="layui/css/modules/layer/default/layer.css">
    <style>
        .page {
            background-image: url("img/bc.jpg");
            position: absolute;
            width: 100%;
            height: 100%;
            background-repeat: no-repeat;
            background-size: 100% 100%;
        }

        .middle {
            width: 100%;
            height: 70%;
            text-align: center;
            display: flex;
            align-items: center;
        }

        .middle > div {
            width: 30%;
            background-color: white;
            margin: 0 auto;
            padding: 20px 10px;
            border-radius: 10px;
            box-shadow: black 0px 0px 5px;
        }
    </style>
</head>
<body>
<div class="page">
    <#include "head.html">
    <div class="middle">
        <div>
            <div style="width: 100%;color: #009688;font-size: 20px">登录</div>
            <hr class="layui-bg-green">
            <form class="layui-form" action="">
                <div class="layui-form-item" style="display: flex;justify-content: flex-start">
                    <div style="border: solid #e6e6e6 1px;display: flex;align-items: center;border-right: none;width: 10%;justify-content: center">
                        <i class="layui-icon">&#xe678;</i>
                    </div>
                    <input style="margin: 0" type="text" name="manager_tel" lay-verType="tips" lay-verify="phone"
                           placeholder="请输入手机号码"
                           autocomplete="off" class="layui-input">
                </div>
                <div class="layui-form-item" style="display: flex;justify-content: flex-start">
                    <div style="border: solid #e6e6e6 1px;display: flex;align-items: center;border-right: none;width: 10%;justify-content: center">
                        <i class="layui-icon">&#xe673;</i>
                    </div>
                    <input style="margin: 0" type="password" name="manager_password" lay-verType="tips"
                           lay-verify="password" placeholder="请输入密码"
                           autocomplete="off" class="layui-input">
                </div>
                <div class="layui-form-item">
                    <label style="text-align: left" class="layui-form-label">记住密码</label>
                    <input type="checkbox" name="rememberme" lay-skin="switch">
                </div>
                <div class="layui-form-item">
                    <button class="layui-btn" lay-submit lay-filter="formDemo" style="width: 100%">立即提交</button>
                </div>
            </form>
        </div>
    </div>
    <#include "footer.html">
</div>
</body>
<script>
    $(".layui-nav>li:first-child").addClass("layui-this");
</script>
<script>
    //注意：导航 依赖 element 模块，否则无法进行功能性操作
    layui.use('element', function () {
        var element = layui.element;
        //…
    });
</script>
<script>
    //Demo
    layui.use('form', function () {
        var form = layui.form;
        //监听提交
        form.on('submit(formDemo)', function (data) {
            $.ajax({
                type: 'POST',
                url: "login/managerLogin",
                data: data.field,
                success: function (res) {
                    if (res.statusCode == "0") {
                        location.href = "Main";
                    } else {
                        layer.alert(res.message);
                    }
                }
            });
            return false;
        });
        form.verify({
            password: [
                /^[\S]{6,12}$/
                , '密码必须6到12位，且不能出现空格'
            ]
        });
        form.on('switch', function (data) {
            $(data.othis).siblings('input').remove();
            $(data.othis).after('<input type="hidden" name=' + $(data.elem).attr('name') + ' value=' + (data.elem.checked ? 'on' : 'off') + '>');
        });
    });
</script>
<script>
    // layer.alert("layui加载成功!");
</script>
</html>